package com.lagou.homework;


import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;

public class ListTest {

    public static void main(String[] args) {
       List<Worker> lt1 = new ArrayList<Worker>();

       lt1.add(new Worker("凤姐",18,20000));
       lt1.add(new Worker("欧阳锋",60,8000));
       lt1.add(new Worker("刘德华",40,30000));
       lt1.add(1,new Worker("张柏芝",35,3300));
       // System.out.println(lt1);
        // 删除刘德华信息
       lt1.remove(3);
       // System.out.println(lt1);
       for(int i = 0; i < lt1.size();i++){
           System.out.println(lt1.get(i));
       }
        Iterator<Worker> iterator = lt1.iterator();
       for(Worker W1: lt1) {
           iterator.next().work();
       }

    }
}
